<template>
  <div class="about">
    <el-card class="box-cardAdd">
      <div style="text-align: left">
        <a  style="color: #409EFF;vertical-align: 5px;" class="el-icon-edit">
          组卷配置</a>
        <i class="el-icon-arrow-right"></i>
        <a  style="color: #409EFF;vertical-align: 5px;pointer-events:none" class="el-icon-lock">
          考试权限</a>
        <i class="el-icon-arrow-right"></i>
        <a  style="color: #9999;vertical-align: 5px;pointer-events:none" class="el-icon-setting">
          补充配置</a>
      </div>
    </el-card>
    <div style="text-align: left;margin: 10px 0">
      <el-button type="primary" style="float: right" @click="goNext()"> 下一步</el-button>
      <el-button @click="goBack()">上一步</el-button>
    </div>
    <div>
      <el-card>
        <div style="text-align: left">
          <el-radio v-model="redios" label="1" border size="medium" style="margin: 10px 0 0 10px">完全公开</el-radio>
          <el-radio v-model="redios" label="2" border size="medium">需要密码</el-radio>
        </div>
        <el-card style="margin: 0px 10px;padding: 10px 5px">
          <div style="margin: 10px;background-color: rgba(255, 165, 0,0.6);
          font-size: 12px;height: 20px;vertical-align: middle;text-align: left" v-show="redios=='1'">
            开放时,任何人都能进入考试
          </div>
          <div style="text-align: left" v-show="redios=='2'">
            <el-input
                style="width: 400px;"
                placeholder="请输入密码"
                v-model="examAddNew.password" >
            </el-input>
          </div>
        </el-card>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      questions:[],
      redios:'2',
      examAddNew:{
        examName:'',
       examDesc:'',
        type:'',
       password:'',
        //考试时间
        duration:'',
        //开始时间
        startTimeStr:'',
        endTimeStr:'',
        //总分
        totalScore:'',
        //及格线
        passScore:'',

        majorId:'',
        majorName:'',
       classIds:'',

        classNames:'',

        questions:[]
      }
    }
  },
  methods:{
    goBack() {
      this.$router.push('/exam/addNew1')
    },
    goNext() {
      this.examAddNew.type = this.redios;
      if(this.examAddNew.password.trim()==""&&this.examAddNew.type=='2'){
        this.$message({
          showClose: true,
          message: '请输入密码',
          type: 'warning'
        });
        return;
      }
      if(this.examAddNew.type=='1'){
        this.examAddNew.password = null;
      }
      let examAddNew = JSON.stringify(this.examAddNew);
      localStorage.setItem("examAddNew",examAddNew)
      this.$router.push('/exam/addNew3')
    },
    LoadExamAddNew(){
      let examAddNew = localStorage.getItem("examAddNew");
      examAddNew = JSON.parse(examAddNew);
      this.examAddNew = examAddNew;
    }
  },
  mounted() {
    this.LoadExamAddNew();
  }
}
</script>
<style>
.box-cardAdd .el-card__body{
  padding: 0;
}
.box-cardAdd .el-card__body a{
  text-decoration: none;
  cursor:pointer;
  margin:0 140px;
  vertical-align: 5px;
  font-size: 14px;
  font-weight: bold;
}
.box-cardAdd .el-card__body i{
  text-decoration: none;
  cursor:pointer;
  margin:0 140px;
  font-size: 14px;
  font-weight: bold;
}
.box-cardAdd .el-card__body i{
  font-size: 32px;
  padding: 0;
  margin:0;
  color: #8492a6
}
</style>
